/**
 * <copyright>
 * </copyright>
 *
 */
package de.sabram.upb.specs.map.impl;

import de.sabram.upb.specs.map.MapPackage;
import de.sabram.upb.specs.map.RuleMapping;
import de.sabram.upb.specs.map.SymbolMapping;
import de.sabram.upb.specs.map.TypeMapFile;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Type Map File</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link de.sabram.upb.specs.map.impl.TypeMapFileImpl#getSymbolMappings <em>Symbol Mappings</em>}</li>
 *   <li>{@link de.sabram.upb.specs.map.impl.TypeMapFileImpl#getRulemapping <em>Rulemapping</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class TypeMapFileImpl extends MinimalEObjectImpl.Container implements TypeMapFile
{
  /**
   * The cached value of the '{@link #getSymbolMappings() <em>Symbol Mappings</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getSymbolMappings()
   * @generated
   * @ordered
   */
  protected EList<SymbolMapping> symbolMappings;

  /**
   * The cached value of the '{@link #getRulemapping() <em>Rulemapping</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getRulemapping()
   * @generated
   * @ordered
   */
  protected EList<RuleMapping> rulemapping;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected TypeMapFileImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return MapPackage.Literals.TYPE_MAP_FILE;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<SymbolMapping> getSymbolMappings()
  {
    if (symbolMappings == null)
    {
      symbolMappings = new EObjectContainmentEList<SymbolMapping>(SymbolMapping.class, this, MapPackage.TYPE_MAP_FILE__SYMBOL_MAPPINGS);
    }
    return symbolMappings;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<RuleMapping> getRulemapping()
  {
    if (rulemapping == null)
    {
      rulemapping = new EObjectContainmentEList<RuleMapping>(RuleMapping.class, this, MapPackage.TYPE_MAP_FILE__RULEMAPPING);
    }
    return rulemapping;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case MapPackage.TYPE_MAP_FILE__SYMBOL_MAPPINGS:
        return ((InternalEList<?>)getSymbolMappings()).basicRemove(otherEnd, msgs);
      case MapPackage.TYPE_MAP_FILE__RULEMAPPING:
        return ((InternalEList<?>)getRulemapping()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case MapPackage.TYPE_MAP_FILE__SYMBOL_MAPPINGS:
        return getSymbolMappings();
      case MapPackage.TYPE_MAP_FILE__RULEMAPPING:
        return getRulemapping();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case MapPackage.TYPE_MAP_FILE__SYMBOL_MAPPINGS:
        getSymbolMappings().clear();
        getSymbolMappings().addAll((Collection<? extends SymbolMapping>)newValue);
        return;
      case MapPackage.TYPE_MAP_FILE__RULEMAPPING:
        getRulemapping().clear();
        getRulemapping().addAll((Collection<? extends RuleMapping>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case MapPackage.TYPE_MAP_FILE__SYMBOL_MAPPINGS:
        getSymbolMappings().clear();
        return;
      case MapPackage.TYPE_MAP_FILE__RULEMAPPING:
        getRulemapping().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case MapPackage.TYPE_MAP_FILE__SYMBOL_MAPPINGS:
        return symbolMappings != null && !symbolMappings.isEmpty();
      case MapPackage.TYPE_MAP_FILE__RULEMAPPING:
        return rulemapping != null && !rulemapping.isEmpty();
    }
    return super.eIsSet(featureID);
  }

} //TypeMapFileImpl
